﻿using AppService.IService.Exception;
using Domain.Entity.Basic_information;
using Domain.Entity.System_operation;
using Domain.Entity.System_Ordermanagement;
using Domain.IRepository.Exception;
using Domain.IRepository.Vehicle_tracks;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;

namespace AppService.Service.Exception_log
{
    [Dependency(ServiceLifetime.Scoped)]
    public class ExceService : IExceService
    {

        public IExceRepository exceRepository { get; set; }

        public ExceService(IExceRepository exceRepository)
        {
            this.exceRepository = exceRepository;
        }

        public List<Domain.Entity.Exception.Exception_log> GetExce(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname, int currentPage, int pageSize)
        {
            return exceRepository.GetExce(status, state, event1, event2, m_time1, m_time2, cname).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public List<Wb_meter> Getwb_Meters(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname, int currentPage, int pageSize)
        {
            return exceRepository.Getwb_Meters(status, state, event1, event2, m_time1, m_time2, cname).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public List<Orders> GetOrders(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname, int currentPage, int pageSize)
        {
            return exceRepository.GetOrders(status, state, event1, event2, m_time1, m_time2, cname).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public List<Drivers_ment> GetDrivers(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname, int currentPage, int pageSize)
        {
            return exceRepository.GetDrivers(status, state, event1, event2, m_time1, m_time2, cname).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public List<Vehicles_ment> GetVehicles(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname, int currentPage, int pageSize)
        {
            return exceRepository.GetVehicles(status, state, event1, event2, m_time1, m_time2, cname).Skip((currentPage - 1) *pageSize).Take(pageSize).ToList();
        }

        public List<Carrier_ment> GetCarriers(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname, int currentPage, int pageSize)
        {
            return exceRepository.GetCarriers(status, state, event1, event2, m_time1, m_time2, cname).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public int GetCount(int status, int state, string event1, string event2, string m_time1, string m_time2, string cname)
        {
            return exceRepository.GetCount(status, state, event1, event2, m_time1, m_time2, cname);
        }

        public List<Wb_meter> GetWb_id()
        {
            return exceRepository.GetWb_id();
        }

        public bool AddExce(Domain.Entity.Exception.Exception_log exception)
        {
            return exceRepository.AddExce(exception) > 0;
        }

        public Domain.Entity.Exception.Exception_log GetException(int id)
        {
            return exceRepository.GetException(id);
        }


        public bool EditExce(Domain.Entity.Exception.Exception_log exception)
        {
            return exceRepository.EditExce(exception) > 0;
        }

        public bool ClExce(Domain.Entity.Exception.Exception_log exception)
        {
            return exceRepository.ClExce(exception) > 0;
        }

        public bool WcExce(int id)
        {
            return exceRepository.WcExce(id) > 0;
        }

        public bool DelExce(int id)
        {
            return exceRepository.DelExce(id) > 0;
        }

    }
}
